home *** CD-ROM | disk | FTP | other *** search
- Path: mn5.swip.net!news
- From: dan.eriksson@vxjkatedral.se (Peter Liljenberg)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Deleting Gadtools gads
- Date: 18 Apr 1996 08:18:23 GMT
- Organization: VΣxj÷ Katedralskola
- Message-ID: <4l4tsf$st6@mn5.swip.net>
- References: <4l2v15$p58@mercury.dur.ac.uk>
- Reply-To: dan.eriksson@vxjkatedral.se (Peter Liljenberg)
- NNTP-Posting-Host: tty17-01.swipnet.se
- X-Newsreader: WinVN 0.92.2
-
- In article <4l2v15$p58@mercury.dur.ac.uk>, M D Sergeant <M.D.Sergeant@durham.ac.uk> says:
- >
- >How do I delete a gadtools gad from a window, I have tried alsorts, but all I
- >get is the gadget becomes just an image, and clicking does nothing. If I resize
- >the window to really small and then enlarge it it goes away. At the moment I
- >call gfx.library:EraseRect(); to get rid of it - surely this is wrong?
- >
- >Thanks for any help.
- >
- >Matt.
- >
-
- You have done a small part of all that is needed to be done. You need to
- remove the gadget from the window's gadgetlist as well. Use RemoveGadget()
- for this, but since a gadtools gadget might contain several standard
- gadgets you can't be sure how many gadgets to remove. There's two ways of
- solving this:
- 1) Add the gadget you want to remove later last when you create the gadget.
- Now you can use RemoveGList(win, gadget, NULL, -1) [I'm not sure of the
- argument order). win is your window, gadget is the one to remove, NULL is
- a pointer to an requester window (don't care about it) and -1 means that
- you should remove all the gadgets in the list from gadget.
- 2) Remove all gadgets with RemoveGList(win, gadgetcontext, NULL, -1).
- gadgetcontext is the gadget set by CreateContext() [Note, don't remove
- ALL the windows gadget by using NULL since this will remove the system
- gadgets as well.] When all gadgets is removed, create the gadgets again
- but skip the gadgets you want to remove.
-
- After having done either 1 or 2 above, you should now use EraseRect() on
- the whole window area (if you mess with the borders you must use
- RefreshWindowFrame() too), RefreshGList(), and GT_RefreshWindow().
-
- The gadget is gone with the blitter!
-
- Method 2 is also used when you have gadgets that adjusts themselves to
- the window size.
-
- Peter Liljenberg
-
- GT_Rer
-